import { useAxios } from '@/hooks/web/useAxios'

const request = useAxios()

export const loginApi = (data) => {
  // return request.post({
  //   url: '/user/login',
  //   data
  // })
  return new Promise((resolve) => {
    resolve({
      data: {
        password: 'admin',
        username: 'admin',
        roleId: '1',
        role: 'admin'
      },
      code: '0000'
    })
  })
}

export const loginOutApi = () => {
  return request.get({ url: '/user/loginOut' })
}

export const getUserListApi = ({ params }) => {
  return request.get({ url: '/user/list', params })
}

export const getAdminRoleApi = ({ params }) => {
  // return request.get({ url: '/role/list', params })
  return new Promise((resolve) => {
    resolve({
      code: '0000',
      data: {
        list: [{
          children: [],
          meta: { icon: 'carbon:skill-level-advanced', title: 'router.level' },
          name: 'Level',
          path: '/level',
          redirect: '/level/menu1/menu1-1/menu1-1-1',
          component: '#'
        }]
      }
    })
  })
}

export const getTestRoleApi = ({ params }) => {
  return request.get({ url: '/role/list', params })
}
